package chapter02;

import java.util.Scanner;

public class anli2 {
    public static void main(String[] args){
        int qianbi=1;
        int xinagpi=2;
        int kele=3;
        int lingshi=5;
        int wo=20-12;
        System.out.println("1.书本的价格为12元，您总共有20元");
        System.out.println("2.铅笔的价格为"+qianbi+"元");
        System.out.println("3.橡皮的价格为"+xinagpi+"元");
        System.out.println("4.可乐的价格为"+kele+"元");
        System.out.println("5.零食的价格为"+lingshi+"元");
        Scanner scl=new Scanner(System.in);
        System.out.println("请输入需要购买的商品序号");
        int id= scl.nextInt();
        switch (id){
            case 1:
               int qian=wo/qianbi;
               int qia=wo%qianbi;
                System.out.println("购买完书本后还可购买铅笔"+qian+"个还剩"+qia+"元");
                break;

            case 2:
                int xiang=wo/xinagpi;
                int xia=wo%xinagpi;
                System.out.println("购买完书本后还可购买橡皮"+xiang+"个还剩"+xia+"元");
                break;

            case 3:
                int ke=wo/kele;
                int kel=wo%kele;
                System.out.println("购买完书本后还可购买可乐"+ke+"个还剩"+kel+"元");
                break;

            case 4:
                int ling=wo/lingshi;
                int lin=wo%lingshi;
                System.out.println("购买完书本后还可购买零食"+ling+"个还剩"+lin+"元");
                break;
        }

    }
}
